home *** CD-ROM | disk | FTP | other *** search
- #include "Devices.h"
- #include "Files.h"
-
- #include "NuDrivers.h"
- #include "NuDriverSupportLib.h"
-
- // Driver Description Symbol
- DriverDescription TheDriverDescription =
- {
- theDescriptionSignature,
- 0,
- 'DISP',
- 'TEST',
- 'TEST',
- 'APPL',
- 0,
- false,
- false,
- 3,
- 'N',
- 'E',
- 'W'
- };
-
- DCtlPtr MyDce;
-
- //////////////////////////////////////////////////////////////
- // Open, Close, KillIO, Initialize, and Finalize are always //
- // ImmediateIORequestKind //
- //////////////////////////////////////////////////////////////
-
- ////////////////////////////////////////////////////
- //
- // DoOpenCmd
- //
- OSErr DoOpenCmd ( ParmBlkPtr thePb)
- {
- return noErr;
- }
-
-
- ////////////////////////////////////////////////////
- //
- // DoCloseCmd
- //
- OSErr DoCloseCmd ( ParmBlkPtr thePb)
- {
- return noErr;
- }
-
-
- ////////////////////////////////////////////////////
- //
- // DoKillIOCmd
- //
- OSErr DoKillIOCmd ( ParmBlkPtr thePb)
- {
- return noErr;
- }
-
- ////////////////////////////////////////////////////
- //
- // DoInitializeCmd
- //
- OSErr DoInitializeCmd ( DCtlPtr theDce)
- {
- // Remember our DCE.
- MyDce = theDce;
-
- return noErr;
- }
-
- ////////////////////////////////////////////////////
- //
- // DoFinalizeCmd
- //
- OSErr DoFinalizeCmd ( DCtlPtr theDce)
- {
- return noErr;
- }
-
- //////////////////////////////////////////////////////////////
- // Read, Write, Status, and Control may be //
- // ImmediateIORequestKind //
- //////////////////////////////////////////////////////////////
-
- ////////////////////////////////////////////////////
- //
- // DoReadCmd
- //
- OSErr DoReadCmd ( ParmBlkPtr thePb)
- {
- return noErr;
- }
-
-
- ////////////////////////////////////////////////////
- //
- // DoWriteCmd
- //
- OSErr DoWriteCmd ( ParmBlkPtr thePb)
- {
- return noErr;
- }
-
-
- ////////////////////////////////////////////////////
- //
- // DoControlCmd
- //
- OSErr DoControlCmd ( ParmBlkPtr thePb)
- {
- return noErr;
- }
-
-
- ////////////////////////////////////////////////////
- //
- // DoStatusCmd
- //
- OSErr DoStatusCmd ( ParmBlkPtr thePb)
- {
- return noErr;
- }
-
-
- //////////////////////////////////////////////////////////////
- //
- // DoDriverIO ( The Driver Entry Point )
- //
- //////////////////////////////////////////////////////////////
- OSErr DoDriverIO ( IOCommandID theID,
- IOCommandContents theContents,
- IOCommandCode theCode,
- IOCommandKind theKind )
- {
- DCtlPtr theDce = theContents.theInitialInfo->theDce;
- ParmBlkPtr thePb = theContents.thePb;
- OSErr ImmediateResult = noErr;
-
- switch ( theCode )
- {
- // The following commands are always immediate.
-
- // Initalize and Finalize take a DCE as the lone parameter
- case InitializeCmd:
- return DoInitializeCmd ( theDce );
- case FinalizeCmd:
- return DoFinalizeCmd ( theDce );
-
- // Open, Close, and KillIO take a PB as the lone parameter
- case OpenCmd:
- return DoOpenCmd ( thePb );
- case CloseCmd:
- return DoCloseCmd ( thePb );
- case KillIOCmd:
- return DoKillIOCmd ( thePb );
-
- // The remaining commands may be immediate.
- case ReadCmd:
- ImmediateResult = DoReadCmd ( thePb );
- break;
- case WriteCmd:
- ImmediateResult = DoWriteCmd ( thePb );
- break;
- case ControlCmd:
- ImmediateResult = DoControlCmd ( thePb );
- break;
- case StatusCmd:
- ImmediateResult = DoStatusCmd ( thePb );
- break;
- }
-
- // If an immediate command make sure to return a valid result
- if ( (theKind & ImmediateIOCommandKind) != 0 )
- return ImmediateResult;
-
- // else return noErr via the new IODone
- return IOCommandIsComplete ( theID, noErr, true );
- }
-
- //////////////////////////////////////////////////////////////
- //
- // Called by CFM upon initialization of the Driver
- //
- //////////////////////////////////////////////////////////////
- CFMInitialize ()
- {
- return noErr;
- }
-
- //////////////////////////////////////////////////////////////
- //
- // Called by CFM upon termination of the Driver
- //
- //////////////////////////////////////////////////////////////
- CFMTerminate ()
- {
- return noErr;
- }
-